<?php

class ForumController extends \Phalcon\Mvc\Controller
{

    public function initInfo()
    {

        $user_id = $this->session->get('user_id');
        $info = UserAccountTb::findFirstById($user_id);
        $this->view->setVar('info',$info);
        
    }

    public function indexAction()
    {
    	$this->view->setMainView('index');
		$this->view->setVar('page_name', 'Forum');
		$this->view->setVar('content', 'forum/index');
		$this->view->setVar('title', '| Forum');


        $this->initInfo();
        $user_id = $this->session->get('user_id');
        $threads = Threads::listThreads();
        $this->view->setVar("threads",$threads);
    }
    public function createAction()
    {
		$this->view->setVar('page_name', 'CreateThread');
		$this->view->setVar('content', 'forum/create');
		$this->view->setVar('title', '| Forum-create');
    }
    public function forumAction()
    {
		$this->view->setVar('page_name', 'Forum');
		$this->view->setVar('content', 'forum/forum');
		$this->view->setVar('title', '| ForumTitle');
    }
    public function profileAction()
    {
		$this->view->setVar('page_name', 'ForumProfile');
		$this->view->setVar('content', 'forum/profile');
		$this->view->setVar('title', '| Forum-'.$this->session->get('fullname'));
    }

}

